package shop.common.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import shop.common.core.Result;


@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = Exception.class)
    public Result handler( Exception e) {
        log.error("服务出现异常: [ {} ]",e.getMessage(),e);
        return Result.fail().data(e.getMessage());
    }
}
